home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / bin / install < prev    next >
Encoding:
Text File  |  1997-07-08  |  8.7 KB  |  286 lines

  1. #!/bin/sh
  2. #
  3. #       $Id: install,v 1.33 1997/03/20 23:48:36 beth Exp $
  4. #
  5. # install
  6. #
  7. # Research Systems, Inc                         March 1, 1988
  8. # This shell script carries out the steps required to install IDL
  9. # or an IDL based product once the main directory has been unpacked.
  10. # It expects to be run from the RSI directory. If no arguments are
  11. # present, the latest IDL version is used, otherwise:
  12. #
  13. #    $1 Product name
  14. #    $2 Version
  15. #
  16.  
  17. # Make sure whoami is found on Solaris
  18. PATH="$PATH:/usr/ucb"
  19. USER=`whoami`
  20. LANDMARK=resource/fonts/hersh1.chr
  21.  
  22.  
  23. # Establish the name (upper and lower case) and the version.
  24. NAME=IDL            # Assume that plain IDL is being installed
  25. PRODUCT=idl
  26. VERSION=5
  27. IDL_VERSION=5            # The current shipping version.
  28. LAYERED=0
  29.  
  30. if [ "$1" != "" ]; then
  31.   NAME=`echo $1 | tr [a-z] [A-Z]`
  32.   PRODUCT=`echo $NAME | tr [A-Z] [a-z]`
  33.   if [ "$PRODUCT" != "idl" ]; then
  34.     LAYERED=1            # There is a layered product on top.
  35.     if [ "$2" != "" ]; then
  36.       VERSION=$2        # This is its version
  37.     fi
  38.   fi
  39. fi
  40.  
  41. RSIDIR=`pwd`
  42. IDLBIN=${RSIDIR}/idl_$IDL_VERSION/bin
  43. PRODUCTBIN=${RSIDIR}/${PRODUCT}_${VERSION}/bin
  44. PRODUCT_VERSION=${PRODUCT}_${VERSION}
  45. PRODUCT_RT=${PRODUCT}_rt
  46. PRODUCT_RT_VERSION=${PRODUCT}_rt_${VERSION}
  47. PRODUCTHELP=${PRODUCT}help
  48. PRODUCTHELP_VERSION=${PRODUCT}help_${VERSION}
  49.  
  50.  
  51. # Preserve the file modes in the source tar files
  52. umask 000
  53.  
  54. if [ ! -f $RSIDIR/idl_$IDL_VERSION/$LANDMARK ]; then
  55.   echo "
  56.     The current directory must be set to the RSI directory.
  57.     Change the default to the RSI directory and re-run
  58.     this script.
  59.         "
  60.   exit 1
  61. fi
  62.  
  63. echo "
  64.     This script installs Unix $NAME version $VERSION. The current
  65.     directory is assumed to be the RSI directory under
  66.     which $NAME is to be installed.
  67.  
  68.     Current directory: " $RSIDIR "
  69.     Current login: $USER
  70. "
  71.  
  72. if [ "$USER" != root ]; then
  73.   echo "
  74.     If this installation is into a public directory,
  75.     you should login as root to do this installation.
  76. "
  77. fi
  78.  
  79. if [ `sh $IDLBIN/yesno "Do you wish to continue"` = 0 ]; then exit 1; fi
  80.  
  81. # Update the generic idl, idl_demo and product symlinks for this platform.
  82.  
  83. if [ -d idl_$IDL_VERSION ]; then
  84.    rm -f idl
  85.    ln -s idl_$IDL_VERSION idl
  86. fi
  87.  
  88. #if [ -d idl_demo_$IDL_VERSION ]; then
  89. #   rm -f idl_demo
  90. #   ln -s idl_demo_$IDL_VERSION idl_demo
  91. #fi
  92.  
  93. if [ \( "$LAYERED" = "1" \) -a \( -d $PRODUCT_VERSION \) ]; then
  94.    rm -f $PRODUCT
  95.    ln -s $PRODUCT_VERSION $PRODUCT
  96. fi
  97.  
  98. # Symbolic links.
  99.  
  100. if [ "$LAYERED" = "1" ]; then
  101.   EXTRA_LN="
  102.            ln -s \$RSI/$PRODUCT/bin/$PRODUCT    LOCAL_DIR/$PRODUCT
  103.            ln -s \$RSI/$PRODUCT_VERSION/bin/$PRODUCT    LOCAL_DIR/$PRODUCT_VERSION
  104.            ln -s \$RSI/$PRODUCT/bin/$PRODUCT_RT    LOCAL_DIR/$PRODUCT_RT
  105.            ln -s \$RSI/$PRODUCT_VERSION/bin/$PRODUCT_RT    LOCAL_DIR/$PRODUCT_RT_VERSION
  106.            ln -s \$RSI/$PRODUCT/bin/$PRODUCTHELP    LOCAL_DIR/$PRODUCTHELP
  107.            ln -s \$RSI/$PRODUCT_VERSION/bin/$PRODUCTHELP    LOCAL_DIR/$PRODUCTHELP_VERSION"
  108. fi
  109.  
  110.  
  111. echo "
  112.     There are 3 ways to create the symbolic links or define
  113.     the environment variables necessary to run $NAME:
  114.  
  115.     1) Allow this script to install $NAME in the RSI recommended
  116.        manner:
  117.  
  118.            - If the rsi directory tree (of which $NAME is a
  119.              subdirectory) is not located in /usr/local/rsi,
  120.              create a symbolic link called /usr/local/rsi that points
  121.              at it.
  122.  
  123.            - Create symbolic links in /usr/local/bin for idl and
  124.              related commands. To run $NAME, users must put
  125.              /usr/local/bin in their execution paths. At most sites,
  126.              this is already the case.
  127.  
  128.     2) You can manually create the symbolic links using the commands:
  129.  
  130.            setenv  RSI  $RSIDIR
  131.            ln -s \$RSI    /usr/local/rsi $EXTRA_LN
  132.  
  133.            ln -s \$RSI/idl_$IDL_VERSION/bin/idl    LOCAL_DIR/idl_$IDL_VERSION
  134.            ln -s \$RSI/idl/bin/idl  LOCAL_DIR/idl
  135.  
  136.            ln -s \$RSI/idl_$IDL_VERSION/bin/idlde    LOCAL_DIR/idlde_$IDL_VERSION
  137.            ln -s \$RSI/idl/bin/idlde  LOCAL_DIR/idlde
  138.  
  139.            ln -s \$RSI/idl_$IDL_VERSION/bin/idlrpc    LOCAL_DIR/idlrpc_$IDL_VERSION
  140.            ln -s \$RSI/idl/bin/idlrpc  LOCAL_DIR/idlrpc
  141.  
  142.            ln -s \$RSI/idl_$IDL_VERSION/bin/insight    LOCAL_DIR/insight_$IDL_VERSION
  143.            ln -s \$RSI/idl/bin/insight  LOCAL_DIR/insight
  144.  
  145.            ln -s \$RSI/idl_$IDL_VERSION/bin/idlhelp    LOCAL_DIR/idlhelp_$IDL_VERSION
  146.            ln -s \$RSI/idl/bin/idlhelp  LOCAL_DIR/idlhelp
  147.            ln -s \$RSI/idl_$IDL_VERSION/bin/idldemo    LOCAL_DIR/idldemo_$IDL_VERSION
  148.            ln -s \$RSI/idl/bin/idldemo    LOCAL_DIR/idldemo
  149.  
  150.       where LOCAL_DIR is the path of a directory on your system
  151.       that commonly appears in users' paths.
  152.  
  153.     3) Files named ${PRODUCT}_setup and ${PRODUCT}_setup.ksh are
  154.        automatically created by the installation script.  These
  155.        files contain appropriate definitions for $NAME-related
  156.        environment variables and aliases.  If you choose this
  157.        option, you must have your users set up their accounts
  158.        as shown below:
  159.  
  160.            Have your C-shell users add the line:
  161.  
  162.                source $RSIDIR/$PRODUCT/bin/${PRODUCT}_setup
  163.  
  164.            to their .cshrc files.
  165.  
  166.            Have your Korn shell users add the line:
  167.  
  168.                . $RSIDIR/$PRODUCT/bin/${PRODUCT}_setup.ksh
  169.  
  170.            to their .profile files.
  171. " | more
  172.  
  173. if [ `sh $IDLBIN/yesno "Create the symbolic links described in option 1 above"` = 0 ]; then
  174.     echo "
  175.     Symbolic links were not created.
  176.  
  177.     After the installation script exits, you must follow
  178.     the instructions as described in (2) or (3) above."
  179. else
  180.   echo " "
  181.   # If the system lacks /usr/local or /usr/local/bin, then create them.
  182.   # If we're not root, then don't bother
  183.   if [ "$USER" = root ]; then
  184.     for DIR in local local/bin; do
  185.       if [ ! -d /usr/$DIR ]; then
  186.         echo "System lacks directory /usr/$DIR. Creating..."
  187.         mkdir /usr/$DIR
  188.         chmod 775 /usr/$DIR
  189.       fi
  190.     done
  191.   fi
  192.  
  193.  
  194.   STATUS=0
  195.  
  196.   # Link RSI directory to /usr/local/rsi. If we are already there,
  197.   # the symbolic link will fall harmlessly inside the rsi
  198.   # directory where we'll find and remove it.
  199.   if [ "$RSIDIR" != "/usr/local/rsi" ]; then    # This if-stmt is not foolproof
  200.     $IDLBIN/make_link $RSIDIR /usr/local/rsi
  201.     if [ $? != 0 ]; then STATUS=1; fi
  202.     if [ -w $RSIDIR/rsi ]; then rm -f $RSIDIR/rsi; fi
  203.   fi
  204.  
  205.   if [ $LAYERED = "1" ]; then
  206.      $IDLBIN/make_link $PRODUCTBIN/$PRODUCT /usr/local/bin/$PRODUCT
  207.      if [ $? != 0 ]; then STATUS=1; fi
  208.  
  209.      $IDLBIN/make_link $PRODUCTBIN/$PRODUCT /usr/local/bin/$PRODUCT_VERSION
  210.      if [ $? != 0 ]; then STATUS=1; fi
  211.  
  212.      $IDLBIN/make_link $PRODUCTBIN/$PRODUCT_RT /usr/local/bin/$PRODUCT_RT
  213.      if [ $? != 0 ]; then STATUS=1; fi
  214.  
  215.      $IDLBIN/make_link $PRODUCTBIN/$PRODUCT_RT /usr/local/bin/$PRODUCT_RT_VERSION
  216.      if [ $? != 0 ]; then STATUS=1; fi
  217.  
  218.      $IDLBIN/make_link $PRODUCTBIN/$PRODUCTHELP /usr/local/bin/$PRODUCTHELP
  219.      if [ $? != 0 ]; then STATUS=1; fi
  220.  
  221.      $IDLBIN/make_link $PRODUCTBIN/$PRODUCTHELP /usr/local/bin/$PRODUCTHELP_VERSION
  222.      if [ $? != 0 ]; then STATUS=1; fi
  223.   fi
  224.  
  225.   $IDLBIN/make_link $IDLBIN/idl /usr/local/bin/idl_$IDL_VERSION
  226.   if [ $? != 0 ]; then STATUS=1; fi
  227.  
  228.   $IDLBIN/make_link $IDLBIN/idl /usr/local/bin/idl
  229.   if [ $? != 0 ]; then STATUS=1; fi
  230.  
  231.   $IDLBIN/make_link $IDLBIN/idlde /usr/local/bin/idlde_$IDL_VERSION
  232.   if [ $? != 0 ]; then STATUS=1; fi
  233.  
  234.   $IDLBIN/make_link $IDLBIN/idlde /usr/local/bin/idlde
  235.   if [ $? != 0 ]; then STATUS=1; fi
  236.  
  237. #  $IDLBIN/make_link $IDLBIN/idldemo /usr/local/bin/idldemo_$IDL_VERSION
  238. #  if [ $? != 0 ]; then STATUS=1; fi
  239.  
  240. #  $IDLBIN/make_link $IDLBIN/idldemo /usr/local/bin/idldemo
  241. #  if [ $? != 0 ]; then STATUS=1; fi
  242.  
  243.   $IDLBIN/make_link $IDLBIN/idlhelp /usr/local/bin/idlhelp_$IDL_VERSION
  244.   if [ $? != 0 ]; then STATUS=1; fi
  245.  
  246.   $IDLBIN/make_link $IDLBIN/idlhelp /usr/local/bin/idlhelp
  247.   if [ $? != 0 ]; then STATUS=1; fi
  248.  
  249.   $IDLBIN/make_link $IDLBIN/idlrpc /usr/local/bin/idlrpc_$IDL_VERSION
  250.   if [ $? != 0 ]; then STATUS=1; fi
  251.  
  252.   $IDLBIN/make_link $IDLBIN/idlrpc /usr/local/bin/idlrpc
  253.   if [ $? != 0 ]; then STATUS=1; fi
  254.  
  255.   $IDLBIN/make_link $IDLBIN/insight /usr/local/bin/insight_$IDL_VERSION
  256.   if [ $? != 0 ]; then STATUS=1; fi
  257.  
  258.   $IDLBIN/make_link $IDLBIN/insight /usr/local/bin/insight
  259.   if [ $? != 0 ]; then STATUS=1; fi
  260.  
  261.  
  262.   if [ "$STATUS" != "0" ]; then
  263.     echo "
  264.     Not all symbolic links were successfully installed.
  265.     Here are your options:
  266.  
  267.         1) Correct the problem that caused this failure and
  268.            re-execute install. (It is OK to execute install more
  269.            than once). Install was run as:
  270.  
  271.                $0 $1 $2
  272.  
  273.         2) Manually create the missing symbolic links.
  274.  
  275.         3) Have all $NAME users on your system use the $PRODUCT_setup
  276.            file as described above.
  277.  
  278.     "
  279.   fi
  280. fi
  281.  
  282. echo "
  283.  
  284. $NAME Installation Complete."
  285.  
  286.